﻿#pragma once

#include "VaoMesh.h"
#include "Shader.h"
#include "Material.h"

struct RenderInfo
{
	glm::mat4 transform;
	glm::vec4 color;

	RenderInfo() :
        color(glm::vec4(1.0f)),
        transform(glm::mat4(1.0f))
	{
	}
};

class Render
{

public:
	Render();
	virtual ~Render();
	//Material容器将被清空，重新分配大小为subMesh数量
	void SetMesh(VaoMesh *vaoMesh);
	void SetMesh(VaoMesh *vaoMesh, std::vector<Material> &materials, Shader *shader);
	//Material指针需要使用new分配，由这个类管理和释放
	void SetMaterial(int index, Material *mate);
	Material *GetMaterial(int i);
	int GetMaterialCount();
	virtual void Draw(int instanceCount);

	VaoMesh *m_vaoMesh;

protected:
	std::vector<Material *> m_materials;
	void DelMaterials();
};
